package com.acv.libs.nbase;

import org.com.app.knock.KnockApplication;

import z.lib.base.BaseAnimationUtils.AnimationAction;
import z.lib.base.CommonAndroid;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.text.Html;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.TextView;

public abstract class Base2Fragment extends LibsBaseFragment implements OnClickListener {
	public Handler mHandle = new Handler();

	public KnockApplication getACVbaseApplication() {
		return (KnockApplication) getActivity().getApplication();
	}

	private AnimationAction animationAction = new AnimationAction() {

		@Override
		public void onAnimationEnd() {
			_onAnimationEnd();
		}
	};

	public void _onAnimationEnd() {

	}

	@Override
	public void startActivity(Intent intent) {
//		startActivityForResult(intent, ByUtils.REQUEST_HOME);
	}

	public AnimationAction getAnimationAction() {
		return animationAction;
	}

	@Override
	public void onClick(View v) {

	}
	
	@Override
	public void onBackPressed() {
		return;
//	     Intent start = new Intent(currentclassname.this,which activity u want.class);
//	        startActivity(start);
//	        finish();
	}
	
	public boolean isFinish() {
		if (getActivity() == null) {
			return true;
		}

		return getActivity().isFinishing();
	}

	public void finish() {
		if (getActivity() != null) {
			getActivity().finish();
		}
	}

	public void showDialogMessage(String message) {
		CommonAndroid.showDialog(getActivity(), message, null);
	}

	private Base2Fragment mparentFragment;

	public void setMParentFragment(Base2Fragment parentFragment) {
		this.mparentFragment = parentFragment;
	}

	public Base2Fragment getMParentFragment() {
		return mparentFragment;
	}

	public void setTextStrHtml(int messagepostFooterText, String string) {
		((TextView) getView().findViewById(messagepostFooterText)).setText(Html.fromHtml(string));
	}

	@Override
	public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

		if (layoytResurce() != 0) {
			View view = inflater.inflate(layoytResurce(), container, false);
			setUpFragment(view);
			return view;
		}

		return super.onCreateView(inflater, container, savedInstanceState);
	}

	public abstract void setUpFragment(View view);

	public abstract int layoytResurce();

	private Object data;

	public void setData(Object object) {
		data = object;
	}

	public Object getData() {
		return data;
	}

	public void setText(String str, int res) {
		((TextView) getView().findViewById(res)).setText(str);
	}


	public String getTextStr(int forgotpasswordEdit) {
		return ((TextView) getView().findViewById(forgotpasswordEdit)).getText().toString().trim();
	}

	public void setTextStr(int messagepostFooterText, String string) {
		((TextView) getView().findViewById(messagepostFooterText)).setText(string);
	}

	public void setChoosePosition(int index) {

	}

	/**
	 * Calendar
	 */

	public static final int CALENDAR = 10212;

	/**
	 * 
	 * @param beginTime
	 * @param endTime
	 * @param title
	 * @param desctipmtion
	 */

	
}